package constant.milk.periodapp.database;

import android.content.Context;

public class DbDeleteQuery
{
	private Context context;
	private DbAdapter db;

	public DbDeleteQuery(Context context, DbAdapter db)
	{
		this.context = context;
		this.db = db;
	}

	public void setBeginTansaction() throws Exception
	{
		db.beginTansaction(context);
	}

	public void setSuccessful() throws Exception
	{
		db.setTransactionSuccessful();
	}

	public void setEndTansaction() throws Exception
	{
		db.endTransaction(context);
	}

	public void setSexDelete(int year, int month, int day) throws Exception
	{
		String[] whereArgs = new String[] { year + "", month + "", day + "" };

		db.delete(context, TableName.SEX_DATE,
				"year = ? AND month = ? AND day = ?", whereArgs);
	}

	public void setMemoDelete(int id) throws Exception
	{
		String[] whereArgs = new String[] { id + "" };

		db.delete(context, TableName.MEMO, "id = ?", whereArgs);
	}

	public void setPeriodDelete(int id) throws Exception
	{
		String[] whereArgs = new String[] { id + "" };

		db.delete(context, TableName.PERIOD_DATE, "id = ?", whereArgs);
	}
}
